//切换
$(function(){


    $("[id=idds]").mouseenter(function(s){
        var $offset =$(this).offset();
        $(".dropdown-menu").show().css({"top":$offset.top+25,"left":$offset.left-40});
       $('.dropdown-menu').mouseleave(function(){
           $('.dropdown-menu').hide();
       })
    })

    $("[name=namess]").each(function(y){
        $(this).click(function(){
            $("[name=namess]").attr("class","button13");
            $(this).attr("class","button14");
            $("[id^=ids_]").slideUp();
            $("#ids_"+(y+1)).slideDown();
        })
        if (y==0) $(this).click();
    })


    $("[name=Names]").each(function(y){
        $(this).click(function(){
            $("[name=Names]") .attr("class","monet_p_no ");
            $(this) .attr("class","monet_p_yes");
            $("[id^=zidp_]").show();
            $("#zidp_"+(y+1)).hide();
        })
        if (y==0) $(this).click();
    })
$('[id=id_1]').click(function(){
    window.open ('Untitled-1.html', 'newwindow', 'height=500, width=504, top=200,left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
})

    $("#idClose").click(function(){
        $("#guideMain").hide();
        $("#maskMain").hide();
    })

    $("[name=zhname]").each(function(y){
        $(this).click(function(){
            $("[name=zhname]") .attr("class","mainer_no1 ");
            $(this) .attr("class","mainer_yes1");
            $("[id^=zidp_]").show();
            $("#zidp_"+(y+1)).hide();
        })
        if (y==0) $(this).click();
    })

    //弹出窗

    $("#mr-cart").click(function(){

        aWidth = 270;
        aHeight = 400;
        aOffsetLeft = ($(document).width()/2) - (parseInt(aWidth)/2) ;
        aOffsetTop = (window.document.documentElement.clientHeight/2) - (aHeight=="auto"?150:parseInt(aHeight)/2)
        $("#cliShow").css( {display:"block", left:aOffsetLeft+"px", top:aOffsetTop+"px", width:aWidth, height:aHeight} );
        $("#cliShow").show();
        $(".dddd").show().css({"height":$(document).height()+"px"});

    })
    $("#idClos").click(function(){
        $("#cliShow").hide();
        $(".dddd").hide();
    })



})



//轮播

!function(n){

    "use strict";
    var t=function(t,i){
            this.$element=n(t);
            this.$indicators=this.$element.find(".marquee-indicators");
            this.options=i;
            this.options.pause=="hover"&&this.$element.on("mouseenter",n.proxy(this.pause,this)).on("mouseleave",n.proxy(this.cycle,this))
        }
        ,i;
    t.prototype={
        cycle:function(t){
            return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(n.proxy(this.next,this),this.options.interval)),this
        }
        ,getActiveIndex:function(){
            return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)
        }
        ,to:function(t){
            var i=this.getActiveIndex(),r=this;
            if(!(t>this.$items.length-1)&&!(t<0))return this.sliding?this.$element.one("slid",function(){
                r.to(t)
            }):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",n(this.$items[t]))
        }
        ,pause:function(t){
            return t||(this.paused=!0),this.$element.find(".next, .prev").length&&n.support.transition.end&&(this.$element.trigger(n.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this
        }
        ,next:function(){
            if(!this.sliding)return this.slide("next")
        }
        ,prev:function(){
            if(!this.sliding)return this.slide("prev")
        }
        ,slide:function(t,i){
            var u=this.$element.find(".item.active"),r=i||u[t](),o=this.interval,s=t=="next"?"left":"right",h=t=="next"?"first":"last",f=this,e;
            if(this.sliding=!0,o&&this.pause(),r=r.length?r:this.$element.find(".item")[h](),e=n.Event("slide",{
                relatedTarget:r[0],direction:s
            }),!r.hasClass("active")){
                if(this.$indicators.length){
                    this.$indicators.find(".active").removeClass("active");
                    this.$element.one("slid",function(){
                        var t=n(f.$indicators.children()[f.getActiveIndex()]);
                        t&&t.addClass("active")
                    })
                }
                if(this.$element.trigger(e),!e.isDefaultPrevented())return u.removeClass("active"),r.addClass("active"),u.fadeOut(300,function(){
                    var t=u.attr("data-bg"),i=r.attr("data-bg");
                    n(".banner").removeClass(t).addClass(i);
                    r.fadeIn(300,function(){
                        f.sliding=!1;
                        f.$element.trigger("slid")
                    })
                }),o&&this.cycle(),this
            }
        }
    };
    i=n.fn.marquee;
    n.fn.marquee=function(i){
        return this.each(function(){
            var f=n(this),r=f.data("marquee"),u=n.extend({},n.fn.marquee.defaults,typeof i=="object"&&i),e=typeof i=="string"?i:u.marqueeSlide;
            r||f.data("marquee",r=new t(this,u));
            typeof i=="number"?r.to(i):e?r[e]():u.interval&&r.pause().cycle()
        })
    };
    n.fn.marquee.defaults={
        interval:5e3,pause:"hover"
    };
    n.fn.marquee.Constructor=t;
    n.fn.marquee.noConflict=function(){
        return n.fn.marquee=i,this
    };
    n(document).on("click.marquee.data-api","[data-marquee-slide], [data-marquee-slide-to]",function(t){
        var i=n(this),u,r=n(i.attr("data-marquee-target")||(u=i.attr("href"))&&u.replace(/.*(?=#[^\s]+$)/,"")),e=n.extend({},r.data(),i.data()),f;
        r.marquee(e);
        (f=i.attr("data-marquee-slide-to"))&&r.data("marquee").pause().to(f).cycle();
        t.preventDefault()
    })
}(window.jQuery)

//初始定位轮播
$(function(s){

    var num=3;
    //点击左边图标变换图片
    $("#idPrev").click(function(){
        num--;
        if(num < 1){
            num=3;
        }
        $("[id^=img_]").fadeOut();
        $("#img_" +num). fadeToggle();

        $("[id^=show_]").attr("class","nos");
        $("#show_"+num).attr("class","on");
        $("[id^=show_]").attr("isClick","0");
        $("#show_"+num).attr("isClick","1");
    })
    //点击右边图标变换图片
    $("#idNext").click(function(){
        num++;
        if(num >=4){
            num=1 ;
        }
        $("[id^=img_]").fadeOut();
        $("#img_" +num). fadeToggle();

        $("[id^=show_]").attr("class","nos");
        $("#show_"+num).attr("class","on");
        $("[id^=show_]").attr("isClick","0");
        $("#show_"+num).attr("isClick","1");
    })
$("[name=scName]").each(function(){
    $(this).click(function(){
        num--;
        if(num < 1){
            num=3;
        }
        $("[id^=img_]").fadeOut();
        $("#img_" +num). fadeToggle();
        $("[id^=show_]").attr("class","nos");
        $("#show_"+num).attr("class","on");
        $("[id^=show_]").attr("isClick","0");
        $("#show_"+num).attr("isClick","1");
    })
})


})



